package fr.vvins.core.user.entity;



import java.io.Serializable;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import fr.vvins.core.dao.EntityImpl;
import fr.vvins.core.order.entity.Order;

/**
 * User entity
 */
@Entity
@Table(schema="vvins", name="VV_USER")

public class User extends EntityImpl implements Serializable {

	private static final long serialVersionUID = 2770800893542713460L;
	@Id
	@GeneratedValue
	@Column(name="ID")
	private Integer id;
	@Basic
	@Column(name="LOGIN")
	private String login;
	@Basic
	@Column(name="PASSWORD")
	private String password;
	@Basic
	@Column(name="FIRSTNAME")
	private String firstName;
	@Basic
	@Column(name="LASTNAME")
	private String lastName;
	@Basic
	@Column(name="GENDER")
	private String gender;
	@Basic
	@Column(name="EMAIL")
	private String email;
	@Basic
	@Column(name="DESCRIPTION")
	private String description;
	@Basic
	@Column(name="CREATION_DATE")
	private Date creationDate;
	@Basic
	@Column(name="PICTURE")
	private String picture;
	@Basic
	@Column(name="SHARE_PROFILE")
	private Boolean shareProfile;
	@OneToMany(mappedBy="user")
	private Set<UserComment> userComments = new HashSet<UserComment>(0);
	@OneToMany(mappedBy="user")
	private Set<UserRating> userRatings = new HashSet<UserRating>(0);
	@OneToMany(mappedBy="user")
	private Set<Order> orders = new HashSet<Order>(0);
	@OneToMany(mappedBy="user")
	private Set<Favorite> favorites = new HashSet<Favorite>(0);
	@ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE})
	@JoinTable(schema="vvins", name="VV_USER_ROLE", joinColumns=@JoinColumn(name="USER_ID"), inverseJoinColumns=@JoinColumn(name="ROLE_ID"))
	private Set<Role> roles = new HashSet<Role>(0);
	@OneToMany(mappedBy="user")
	private Set<UserContact> userContacts = new HashSet<UserContact>(0);
	@OneToMany(mappedBy="user")
	private Set<UserCommunity> userCommunities = new HashSet<UserCommunity>(0);
	@OneToMany(mappedBy="user")
	private Set<UserLog> userLogs = new HashSet<UserLog>(0);
	@ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE})
	@JoinTable(schema="vvins", name="VV_SUBSCRIPTION", joinColumns=@JoinColumn(name="USER_ID"), inverseJoinColumns=@JoinColumn(name="FOLLOWED_USER_ID"))
	private Set<User> followingUser = new HashSet<User>(0);

	public User() {
	}

	public User(Integer id, String login, String password, String email,
			String description, Date creationDate, Boolean shareProfile,
			Set<UserComment> userComments, Set<Order> orders,
			Set<Favorite> favorites, Set<Role> roles,
			Set<UserContact> userContacts, Set<UserCommunity> userCommunities,
			Set<UserLog> userLogs, Set<User> followedUser) {
		super();
		this.id = id;
		this.login = login;
		this.password = password;
		this.email = email;
		this.description = description;
		this.creationDate = creationDate;
		this.shareProfile = shareProfile;
		this.userComments = userComments;
		this.orders = orders;
		this.favorites = favorites;
		this.roles = roles;
		this.userContacts = userContacts;
		this.userCommunities = userCommunities;
		this.userLogs = userLogs;
		this.followingUser = followedUser;
	}

	@Override
	public Integer getId() {
		return id;
	}

	@Override
	public void setId(Integer id) {
		this.id = id;
	}

	public String getLogin() {
		return login;
	}

	public void setLogin(String login) {
		this.login = login;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Date getCreationDate() {
		return creationDate;
	}

	public void setCreationDate(Date creationDate) {
		this.creationDate = creationDate;
	}

	public Boolean getShareProfile() {
		return shareProfile;
	}

	public void setShareProfile(Boolean shareProfile) {
		this.shareProfile = shareProfile;
	}

	public Set<UserComment> getUserComments() {
		return userComments;
	}

	public void setUserComments(Set<UserComment> userComments) {
		this.userComments = userComments;
	}

	public Set<Order> getOrders() {
		return orders;
	}

	public void setOrders(Set<Order> orders) {
		this.orders = orders;
	}

	public Set<Favorite> getFavorites() {
		return favorites;
	}

	public void setFavorites(Set<Favorite> favorites) {
		this.favorites = favorites;
	}

	public Set<Role> getRoles() {
		return roles;
	}

	public void setRoles(Set<Role> roles) {
		this.roles = roles;
	}

	public Set<UserContact> getUserContacts() {
		return userContacts;
	}

	public void setUserContacts(Set<UserContact> userContacts) {
		this.userContacts = userContacts;
	}

	public Set<UserCommunity> getUserCommunities() {
		return userCommunities;
	}

	public void setUserCommunities(Set<UserCommunity> userCommunities) {
		this.userCommunities = userCommunities;
	}

	public Set<UserLog> getUserLogs() {
		return userLogs;
	}

	public void setUserLogs(Set<UserLog> userLogs) {
		this.userLogs = userLogs;
	}

	public Set<User> getFollowingUser() {
		return followingUser;
	}

	public void setFollowingUser(Set<User> followingUser) {
		this.followingUser = followingUser;
	}

	public Set<UserRating> getUserRatings() {
		return userRatings;
	}

	public void setUserRatings(Set<UserRating> userRatings) {
		this.userRatings = userRatings;
	}

	public String getPicture() {
		return picture;
	}

	public void setPicture(String picture) {
		this.picture = picture;
	}

	public String getFirstname() {
		return firstName;
	}

	public void setFirstName(String firstname) {
		this.firstName = firstname;
	}

	public String getLastName() {
		return lastName;
	}

	public void setLastName(String lastname) {
		this.lastName = lastname;
	}

	public String getGender() {
		return gender;
	}

	public void setGender(String gender) {
		this.gender = gender;
	}

	

}
